package com.lc.usercenter.common;

import lombok.Data;

import java.io.Serializable;

/**
 * 功能：通用响应类
 * 作者：lc
 * 日期：2024/11/24 18:55
 */
@Data
public class BaseResponse<T> implements Serializable {

    // 状态码
    private int code;
    // 返回数据
    private T data;
    // 返回信息
    private String message;

    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponse(int code, T data) {
        this(code, data, "");
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage());
    }
}
